package com.ymttest.database.sqlwapper;

import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;
import com.ymttest.utils.EnvSetup;

public class CSearchWapper {
	
	SqlManager manage;

	public CSearchWapper() {
		manage = new SqlManager("app" + EnvSetup.getEnv());
	}
	

	/**
	 * 根据商品id查找商品信息
	 * @param uid 
	 * */
	public List<Map> selectProductInfo(String productid){
		List<Map> list = manage.getSelectResults("com.ymttest.database.mapping.CSearchMapper.selectProductInfo",productid);
		return list;
		
	}
	
	/**
	 * 根据topicid查找topic信息
	 * @param topicid 
	 * */
	public List<Map> selectTopicInfo(String topicid){
		List<Map> list = manage.getSelectResults("com.ymttest.database.mapping.CSearchMapper.selectTopicInfo",topicid);
		return list;
		
	}
	
	/**
	 * 查询C端有效商品
	 * */
	public List<Map> getProductById(String sProductId){
		
		List<Map> list =  manage.getSelectResults("com.ymttest.database.mapping.CSearchMapper.selectProduct",sProductId);
		return list;
		
	}
	
	/**
	 * 关闭数据库连接
	 */
	public void close() {
		manage.close();
	}

	@Override
	protected void finalize() throws Throwable {
		this.close();
		manage = null;
		super.finalize();
	}

	public static void main(String args[]) {
		
		/*List<Map> aa = new CSearchWapper().getProductById("14ff88b8-1063-40f9-a63a-9f07a178b43e");
		Logger.debug(aa);*/
		

	}
}
